import 'dart:ui';

import 'package:flutter/material.dart';

class MyColors {
  static const Color primaryColor = Color.fromRGBO(204, 25, 88, 1.0);
  Color getTimeTextColor(BuildContext context) {
    if (MediaQuery
        .of(context)
        .platformBrightness == Brightness.dark) { // 夜晚模式下的颜色
      return Color.fromRGBO(71, 71, 71, 1.0);
    } else { // 白天模式下的颜色
      return Color.fromRGBO(255, 255, 255, 1.0);
    }
  }
  MaterialStateProperty<Color?>? getTimeColor(BuildContext context) {
    return MaterialStateProperty.resolveWith<Color>((states) {

      if (MediaQuery
          .of(context)
          .platformBrightness == Brightness.dark) { // 夜晚模式下的颜色
        if (states.contains(MaterialState.disabled)) {
          return Color.fromRGBO(55, 55, 55, 0.7); // 禁用时的颜色
        }
        if (states.contains(MaterialState.pressed)) {
          return Colors.orangeAccent; // 按下时的颜色
        } else {
          return Colors.deepOrange;
        }
      }

      else { // 白天模式下的颜色
        if (states.contains(MaterialState.disabled)) {
          return Color.fromRGBO(178, 178, 178, 0.7019607843137254); // 禁用时的颜色
        }
        if (states.contains(MaterialState.pressed)) {
          return MyColors.primaryColor;
        } else {
          return Colors.blue;
        }
      }

    }
    );
  }
}